<template>
  <div class="container">
    <home-common-search :value="params.keyword" type="good"></home-common-search>
    <div class="goodlistnav">
      <div class="goodlist-nav">
        <div :class="{'active':!nav}" @click="switchnav(0)">商品</div>
        <div :class="{'active':nav}" @click="switchnav(1)">店铺</div>
      </div>
    </div>
    <goodslist-body v-if="!nav"></goodslist-body>
    <common-store-list v-if="nav" />

    <!--        <div v-if="nav" class="store-main">-->
    <!--            <div class="storm-list">-->
    <!--                -->
    <!--            </div>-->
    <!--        </div>-->
  </div>
</template>

<script>
import HomeCommonSearch from "../common/HomeCommonSearch";
import GoodslistBody from "./GoodslistBody";
import CommonStoreList from "../common/CommonStoreList";

export default {
  name: "HomeGoodslist",
  components: {
    HomeCommonSearch,
    GoodslistBody,
    CommonStoreList,
  },

  data() {
    return {
      params: {
        keyword: this.$route.query.keywords ? this.$route.query.keywords : "",
      },
      nav: 0, // 当前选中目录值 0:目录 1:简介
    };
  },

  created() {},
  methods: {
    // 切换栏目
    switchnav(index) {
      this.nav = index;
    },
  },
};
</script>

<style scoped lang='scss'>
.goodlistnav{
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 123;
  background-color: #ffffff;

}
.goodlist-nav {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  width: 50vw;
  margin: auto;
  margin-top: 50px;
  margin-bottom: 0.5rem;
  padding: 5px 0 0 0;
  div {
    padding: 8px 0;
    font-size: 0.7rem;
    font-weight: bold;
  }
  .active {
    color: #3c7c45;
    border-bottom: 3px solid #3c7c45;
  }
}
</style>
